<?php
/**
 * Created by PhpStorm.
 * User: minicart
 * Date: 2018/10/15
 * Time: 16:43
 */
namespace app\models;

use think\Model;

/**
 * Class TypeModel
 * @package app\models
 */
class TypeModel extends Model
{
    protected $table = 'edu_type';

    /**
     * 列表 -分页
     * @param $where
     * @param int $page
     * @param int $limit
     * @param string $order
     * @return array
     * @throws \think\exception\DbException
     */
    public static function pageLists($where, $page = 1, $limit = 10, $order = 'id desc')
    {
        $lists = self::where($where)->order($order)->paginate($limit, false, ['page' => $page]);
        if (!$lists->total()) {
            return ['code' => 0, 'msg' => "", 'count' => 0, 'data' => []];
        }
        $lists = $lists->toArray();
        return ['code' => 0, 'msg' => "", 'count' => $lists['total'], 'data' => $lists['data']];
    }
}